<template>
  <el-dialog
    :title="!dataForm.id ? '申请借阅' : '修改'"
    :close-on-click-modal="false"
    :visible.sync="visible"
  >
    <el-form
      :model="dataForm"
      :rules="dataRule"
      ref="dataForm"
      @keyup.enter.native="dataFormSubmit()"
      label-width="80px"
    >


      <el-form-item label="书籍编号" prop="price">
        <el-input v-model="dataForm.price" placeholder="书籍编号"></el-input>
      </el-form-item>
      
      <el-form-item>
          <el-input v-model="dataForm.price" placeholder="书籍编号"></el-input>
      </el-form-item>

    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      values: [],
      options: [
        {
          value: "",
          label: "",
          children: [],
        },
      ],
      visible: false,
      dataForm: {
        id: 0,
        name: "",
        author: "",
        isbn: "",
        publisher: "",
        language: "",
        descirption: "",
        price: "",
        count: "",
        location: "",
        imgUrl: "",
      },
      dataRule: {
        name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
        author: [{ required: true, message: "作者不能为空", trigger: "blur" }],
        isbn: [
          { required: true, message: "ISBN编号不能为空", trigger: "blur" },
        ],
        publisher: [
          { required: true, message: "发行者不能为空", trigger: "blur" },
        ],
        language: [
          { required: true, message: "语言不能为空", trigger: "blur" },
        ],
        descirption: [
          { required: true, message: "描述不能为空", trigger: "blur" },
        ],
        price: [{ required: true, message: "价格不能为空", trigger: "blur" }],
        count: [{ required: true, message: "数量不能为空", trigger: "blur" }],
        values: [{ required: true, message: "位置不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    init(id) {
      this.visible = true;
      console.log(id);
    },
  },
};
</script>
